package com.leetroll.media.temp;

import com.aliyun.oss.ClientBuilderConfiguration;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.leetroll.common.enums.EBucket;

import java.util.Date;

public class AliyunUtilForTest {

    public static void main(String[] args) {
        String endpoint = "store.leetroll.com";
        String access_key = "LTAI5tBr3Pr36HBcoHps5QPF";
        String access_secret = "L3HLKW6courroWj9sisU33M8qqHGwe";
        ClientBuilderConfiguration conf = new ClientBuilderConfiguration();
        conf.setSupportCname(true);
        OSS client = new OSSClientBuilder().build(endpoint, access_key, access_secret, conf);

        //获取url
        Date expirationDate = new Date(System.currentTimeMillis() + 30 * 60 * 60 * 24 * 365 * 1000L);
//        String url = client.generatePresignedUrl(EBucket.PRIVATE_BUCKET.getBucket(), "config/default_bg/bg5.jpg", expirationDate).toString();
        String url = client.generatePresignedUrl(EBucket.PRIVATE_BUCKET.getBucket(), "cat/7/metrics/props.png", expirationDate).toString();
        System.out.println(url);

        //updateAcl
//        for (int i = 20; i < 90; i++) {
//            StringBuilder name = new StringBuilder("000000");
//            name.append(i);
//            System.out.println(name);
//            //item/8335/chapter/7/chapter_video/1/00000000.ts
//            updateAcl(EBucket.PRIVATE_BUCKET.getBucket(), "item/8335/chapter/7/chapter_video/1/" + name + ".ts");
//        }

        //updateContentType
//        updatecontentType();
    }
}
